package io.renren.modules.app.controller;

import java.util.Arrays;
import java.util.Map;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.app.entity.ScriptRunDetailsEntity;
import io.renren.modules.app.service.ScriptRunDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;




/**
 * 
 *
 * @author yaofa
 * @email test@test.com
 * @date 2022-04-24 20:19:42
 */
@RestController
@RequestMapping("product/scriptrundetails")
public class ScriptRunDetailsController {
    @Autowired
    private ScriptRunDetailsService scriptRunDetailsService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = scriptRunDetailsService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
		ScriptRunDetailsEntity scriptRunDetails = scriptRunDetailsService.getById(id);

        return R.ok().put("scriptRunDetails", scriptRunDetails);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody ScriptRunDetailsEntity scriptRunDetails){
		scriptRunDetailsService.save(scriptRunDetails);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody ScriptRunDetailsEntity scriptRunDetails){
		scriptRunDetailsService.updateById(scriptRunDetails);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
		scriptRunDetailsService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
